<#include "../common/constant.ftl" />
<title>用户列表</title>
<form class="form-horizontal" role="form" id="validation-form" method="POST" action="${ctx}/admin/member/list${suffix}" onsubmit="return fromSearch(this)">
	手机号:<input type="input" name="name" value="${pager.searchMap.title!''}" id="title"/>
	<button class="btn btn-minier btn-success" type="submit"><i class="fa fa-search"></i>搜  索</button>
</form>
<div class="hr hr-5"></div>
<div class="row">
	<div class="col-xs-12">
		<div class="table-responsive">
			<table id="sample-table-1" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th class="center" width="10%">ID</th>
						<th class="center" width="9%">头像</th>
						<th class="center" width="15%">手机号</th>
						<th class="center" width="15%">注册时间</th>
						<th class="center" width="10%">最后登录时间</th>
						<th class="center" width="10%">优惠码</th>
						<th class="center" width="10%">注册TIM</th>
						<th class="center" width="6%">状态</th>
					</tr>
				</thead>
				<tbody>
				<#list pager.itemList as u>
					<tr>
						<td class="center">${u.id!''}</td>
						<td class="center"><a href="${u.headImg!''}" target="_blank" title="点击查看大图"><img src="${u.headImg!''}" width="30" height="30"/></a></td>
					    <td class="center">${u.contact!'未绑定'}</td>
						<td class="center">${tagUtils.formatDate(u.recordCreateTime!'0')}</td>
						<td class="center"><#if u.lastLoginTime??>${tagUtils.formatDate(u.lastLoginTime!'0')}</#if></td>
						<td class="center">${u.couponsCode!""}</td>
						  <td class="center"><#if u.regTIMDate??>${tagUtils.formatDate(u.regTIMDate!'0')}<#else>未注册</#if></td>
						<td class="center">
						<#assign cState=(u.state)!0 />
						<div class="col-xs-3">
								<label>
									<input name="switch-field-1" class="ace ace-switch ace-switch-4" type="checkbox" onchange="doUserState(this, ${u.id});" <#if cState == 1>checked=true</#if>>
									<span class="lbl"></span>
								</label>
						</div>
						</td>
					
					</tr>
				</#list>
				</tbody>
			</table>
		</div><!-- /.table-responsive -->
		
		<div class="hr hr-18 dotted hr-double"></div>
		<@h.page pager=pager action="${ctx}/admin/member/list${suffix}" />
	</div><!-- /span -->
</div><!-- /row -->

<script>

function doUserState(checkbox, uid) {
	var str ;
	if(checkbox.checked == true){
		str ="启用";
		checkbox.checked = false;
	}else{
		str = "禁用";
		checkbox.checked = true;
	}
 	if(confirm("确定要"+str+"该用户吗？")){
 		var href = ctx + "/admin/member/" + uid +"/checkState";
		window.location.href = href;
 	}

}

function fromSearch(f){
	if(f.informationTypeId.value) {
		f.pager.value += "$$informationTypeId--" + f.informationTypeId.value;
	}
	if(f.title.value){
		f.pager.value += "$$title--" + f.title.value;
	}
	location.href = f.action + "?pager=" + f.pager.value;
	return false;
}

</script>
